3.53 \(\int \frac{\cot ^2(c+d x)}{a+i a \tan (c+d x)} \, dx\)

Optimal. Leaf size=70 \[ -\frac{3 \cot (c+d x)}{2 a d}-\frac{i \log (\sin (c+d x))}{a d}+\frac{\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{3 x}{2 a} \]

[Out]

(-3*x)/(2*a) - (3*Cot[c + d*x])/(2*a*d) - (I*Log[Sin[c + d*x]])/(a*d) + Cot[c + d*x]/(2*d*(a + I*a*Tan[c + d*x
]))

________________________________________________________________________________________

Rubi [A]  time = 0.098075, antiderivative size = 70, normalized size of antiderivative = 1., number of steps used = 4, number of rules used = 4, integrand size = 24, \(\frac{\text{number of rules}}{\text{integrand size}}\) = 0.167, Rules used = {3552, 3529, 3531, 3475} \[ -\frac{3 \cot (c+d x)}{2 a d}-\frac{i \log (\sin (c+d x))}{a d}+\frac{\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{3 x}{2 a} \]

Antiderivative was successfully verified.

[In]

Int[Cot[c + d*x]^2/(a + I*a*Tan[c + d*x]),x]

[Out]

(-3*x)/(2*a) - (3*Cot[c + d*x])/(2*a*d) - (I*Log[Sin[c + d*x]])/(a*d) + Cot[c + d*x]/(2*d*(a + I*a*Tan[c + d*x
]))

Rule 3552

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_)/((a_) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> -Simp[(a
*(c + d*Tan[e + f*x])^(n + 1))/(2*f*(b*c - a*d)*(a + b*Tan[e + f*x])), x] + Dist[1/(2*a*(b*c - a*d)), Int[(c +
 d*Tan[e + f*x])^n*Simp[b*c + a*d*(n - 1) - b*d*n*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f, n}, x]
&& NeQ[b*c - a*d, 0] && EqQ[a^2 + b^2, 0] && NeQ[c^2 + d^2, 0] &&  !GtQ[n, 0]

Rule 3529

Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((
b*c - a*d)*(a + b*Tan[e + f*x])^(m + 1))/(f*(m + 1)*(a^2 + b^2)), x] + Dist[1/(a^2 + b^2), Int[(a + b*Tan[e +
f*x])^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c
 - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1]

Rule 3531

Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[((a*c +
 b*d)*x)/(a^2 + b^2), x] + Dist[(b*c - a*d)/(a^2 + b^2), Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x]
 /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && NeQ[a*c + b*d, 0]

Rule 3475

Int[tan[(c_.) + (d_.)*(x_)], x_Symbol] :> -Simp[Log[RemoveContent[Cos[c + d*x], x]]/d, x] /; FreeQ[{c, d}, x]

Rubi steps

\begin{align*} \int \frac{\cot ^2(c+d x)}{a+i a \tan (c+d x)} \, dx &=\frac{\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{\int \cot ^2(c+d x) (-3 a+2 i a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac{3 \cot (c+d x)}{2 a d}+\frac{\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{\int \cot (c+d x) (2 i a+3 a \tan (c+d x)) \, dx}{2 a^2}\\ &=-\frac{3 x}{2 a}-\frac{3 \cot (c+d x)}{2 a d}+\frac{\cot (c+d x)}{2 d (a+i a \tan (c+d x))}-\frac{i \int \cot (c+d x) \, dx}{a}\\ &=-\frac{3 x}{2 a}-\frac{3 \cot (c+d x)}{2 a d}-\frac{i \log (\sin (c+d x))}{a d}+\frac{\cot (c+d x)}{2 d (a+i a \tan (c+d x))}\\ \end{align*}

Mathematica [B]  time = 0.610213, size = 286, normalized size = 4.09 \[ \frac{\csc \left (\frac{c}{2}\right ) \sec \left (\frac{c}{2}\right ) \csc (c+d x) \sec (c+d x) \left (-4 d x \sin (c)-2 d x \sin (c+2 d x)-7 i \sin (c+2 d x)+2 d x \sin (3 c+2 d x)-i \sin (3 c+2 d x)+2 i d x \cos (c+2 d x)-9 \cos (c+2 d x)-2 i d x \cos (3 c+2 d x)+\cos (3 c+2 d x)-4 i \sin (c) \log \left (\sin ^2(c+d x)\right )-2 i \sin (c+2 d x) \log \left (\sin ^2(c+d x)\right )+2 i \sin (3 c+2 d x) \log \left (\sin ^2(c+d x)\right )-2 \cos (c+2 d x) \log \left (\sin ^2(c+d x)\right )+2 \cos (3 c+2 d x) \log \left (\sin ^2(c+d x)\right )+16 i \sin (c) \tan ^{-1}(\tan (d x)) \sin (c+d x) (\cos (c+d x)+i \sin (c+d x))+10 i \sin (c)+8 \cos (c)\right )}{32 a d (\tan (c+d x)-i)} \]

Antiderivative was successfully verified.

[In]

Integrate[Cot[c + d*x]^2/(a + I*a*Tan[c + d*x]),x]

[Out]

(Csc[c/2]*Csc[c + d*x]*Sec[c/2]*Sec[c + d*x]*(8*Cos[c] - 9*Cos[c + 2*d*x] + (2*I)*d*x*Cos[c + 2*d*x] + Cos[3*c
 + 2*d*x] - (2*I)*d*x*Cos[3*c + 2*d*x] - 2*Cos[c + 2*d*x]*Log[Sin[c + d*x]^2] + 2*Cos[3*c + 2*d*x]*Log[Sin[c +
 d*x]^2] + (10*I)*Sin[c] - 4*d*x*Sin[c] - (4*I)*Log[Sin[c + d*x]^2]*Sin[c] + (16*I)*ArcTan[Tan[d*x]]*Sin[c]*(C
os[c + d*x] + I*Sin[c + d*x])*Sin[c + d*x] - (7*I)*Sin[c + 2*d*x] - 2*d*x*Sin[c + 2*d*x] - (2*I)*Log[Sin[c + d
*x]^2]*Sin[c + 2*d*x] - I*Sin[3*c + 2*d*x] + 2*d*x*Sin[3*c + 2*d*x] + (2*I)*Log[Sin[c + d*x]^2]*Sin[3*c + 2*d*
x]))/(32*a*d*(-I + Tan[c + d*x]))

________________________________________________________________________________________

Maple [A]  time = 0.065, size = 91, normalized size = 1.3 \begin{align*}{\frac{{\frac{5\,i}{4}}\ln \left ( \tan \left ( dx+c \right ) -i \right ) }{ad}}-{\frac{1}{2\,ad \left ( \tan \left ( dx+c \right ) -i \right ) }}-{\frac{{\frac{i}{4}}\ln \left ( \tan \left ( dx+c \right ) +i \right ) }{ad}}-{\frac{1}{ad\tan \left ( dx+c \right ) }}-{\frac{i\ln \left ( \tan \left ( dx+c \right ) \right ) }{ad}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

int(cot(d*x+c)^2/(a+I*a*tan(d*x+c)),x)

[Out]

5/4*I/d/a*ln(tan(d*x+c)-I)-1/2/a/d/(tan(d*x+c)-I)-1/4*I/d/a*ln(tan(d*x+c)+I)-1/d/a/tan(d*x+c)-I/d/a*ln(tan(d*x
+c))

________________________________________________________________________________________

Maxima [F(-2)]  time = 0., size = 0, normalized size = 0. \begin{align*} \text{Exception raised: RuntimeError} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2/(a+I*a*tan(d*x+c)),x, algorithm="maxima")

[Out]

Exception raised: RuntimeError

________________________________________________________________________________________

Fricas [A]  time = 2.23496, size = 286, normalized size = 4.09 \begin{align*} -\frac{10 \, d x e^{\left (4 i \, d x + 4 i \, c\right )} -{\left (10 \, d x - 9 i\right )} e^{\left (2 i \, d x + 2 i \, c\right )} -{\left (-4 i \, e^{\left (4 i \, d x + 4 i \, c\right )} + 4 i \, e^{\left (2 i \, d x + 2 i \, c\right )}\right )} \log \left (e^{\left (2 i \, d x + 2 i \, c\right )} - 1\right ) - i}{4 \,{\left (a d e^{\left (4 i \, d x + 4 i \, c\right )} - a d e^{\left (2 i \, d x + 2 i \, c\right )}\right )}} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2/(a+I*a*tan(d*x+c)),x, algorithm="fricas")

[Out]

-1/4*(10*d*x*e^(4*I*d*x + 4*I*c) - (10*d*x - 9*I)*e^(2*I*d*x + 2*I*c) - (-4*I*e^(4*I*d*x + 4*I*c) + 4*I*e^(2*I
*d*x + 2*I*c))*log(e^(2*I*d*x + 2*I*c) - 1) - I)/(a*d*e^(4*I*d*x + 4*I*c) - a*d*e^(2*I*d*x + 2*I*c))

________________________________________________________________________________________

Sympy [A]  time = 1.61645, size = 100, normalized size = 1.43 \begin{align*} - \frac{\left (\begin{cases} 5 x e^{2 i c} + \frac{i e^{- 2 i d x}}{2 d} & \text{for}\: d \neq 0 \\x \left (5 e^{2 i c} + 1\right ) & \text{otherwise} \end{cases}\right ) e^{- 2 i c}}{2 a} - \frac{i \log{\left (e^{2 i d x} - e^{- 2 i c} \right )}}{a d} - \frac{2 i e^{- 2 i c}}{a d \left (e^{2 i d x} - e^{- 2 i c}\right )} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)**2/(a+I*a*tan(d*x+c)),x)

[Out]

-Piecewise((5*x*exp(2*I*c) + I*exp(-2*I*d*x)/(2*d), Ne(d, 0)), (x*(5*exp(2*I*c) + 1), True))*exp(-2*I*c)/(2*a)
 - I*log(exp(2*I*d*x) - exp(-2*I*c))/(a*d) - 2*I*exp(-2*I*c)/(a*d*(exp(2*I*d*x) - exp(-2*I*c)))

________________________________________________________________________________________

Giac [A]  time = 1.43098, size = 124, normalized size = 1.77 \begin{align*} -\frac{-\frac{10 i \, \log \left (\tan \left (d x + c\right ) - i\right )}{a} + \frac{2 i \, \log \left (-i \, \tan \left (d x + c\right ) + 1\right )}{a} + \frac{8 i \, \log \left ({\left | \tan \left (d x + c\right ) \right |}\right )}{a} + \frac{\tan \left (d x + c\right )^{2} - 13 i \, \tan \left (d x + c\right ) - 8}{{\left (-i \, \tan \left (d x + c\right )^{2} - \tan \left (d x + c\right )\right )} a}}{8 \, d} \end{align*}

Verification of antiderivative is not currently implemented for this CAS.

[In]

integrate(cot(d*x+c)^2/(a+I*a*tan(d*x+c)),x, algorithm="giac")

[Out]

-1/8*(-10*I*log(tan(d*x + c) - I)/a + 2*I*log(-I*tan(d*x + c) + 1)/a + 8*I*log(abs(tan(d*x + c)))/a + (tan(d*x
 + c)^2 - 13*I*tan(d*x + c) - 8)/((-I*tan(d*x + c)^2 - tan(d*x + c))*a))/d